package com.youme.tools.cg.db.enums;

public enum OracleDataType {
  /** CHAR goto String */
  CHAR("CHAR", "String"),
  /** VARCHAR goto String */
  VARCHAR("VARCHAR", "String"),
  /** VARCHAR2 goto String */
  VARCHAR2("VARCHAR2", "String"),
  /** NCHAR goto String */
  NCHAR("NCHAR", "String"),
  /** NVARCHAR2 goto String */
  NVARCHAR2("NVARCHAR2", "String"),
  /** CLOB goto String */
  CLOB("CLOB", "String"),
  /** NCLOB goto String */
  NCLOB("NCLOB", "String"),
  /** LONG goto String */
  LONG("LONG", "String"),
  /** BLOB goto String */
  BLOB("BLOB", "String"),
  /** BFILE goto String */
  BFILE("BFILE", "String"),
  /** NUMBER goto Long */
  NUMBER("NUMBER", "Long"),
  /** BINARY_FLOAT goto java.math.BigDecimal */
  BINARY_FLOAT("BINARY_FLOAT", "java.math.BigDecimal"),
  /** BINARY_DOUBLE goto java.math.BigDecimal */
  BINARY_DOUBLE("BINARY_DOUBLE", "java.math.BigDecimal"),
  /** DATE goto String */
  DATE("DATE", "String"),
  /** TIMESTAMP goto String */
  TIMESTAMP("TIMESTAMP", "String"),
  /** RAW goto String */
  RAW("RAW", "String"),
  /** XMLType goto String */
  XMLType("XMLType", "String");

  /** 数据库类型 */
  private String dbType;
  /** Java类型 */
  private String javaType;

  /**
   * 
   * 构造函数
   * 
   * @param dbType 数据库类型
   * @param javaType Java类型
   */
  private OracleDataType(String dbType, String javaType) {
    this.dbType = dbType;
    this.javaType = javaType;
  }

  /**
   * 根据数据库类型获得Java类型
   * 
   * @Title: getJavaTypeByDbType
   * @Description: 根据数据库类型获得Java类型
   * @param dbType 数据库类型
   * @return Java类型
   */
  public static String getJavaTypeByDbType(String dbType) {
    switch (dbType) {
      case "CHAR":
        return CHAR.getJavaType();
      case "VARCHAR":
        return VARCHAR.getJavaType();
      case "VARCHAR2":
        return VARCHAR2.getJavaType();
      case "NCHAR":
        return NCHAR.getJavaType();
      case "NVARCHAR2":
        return NVARCHAR2.getJavaType();
      case "CLOB":
        return CLOB.getJavaType();
      case "NCLOB":
        return NCLOB.getJavaType();
      case "LONG":
        return LONG.getJavaType();
      case "BLOB":
        return BLOB.getJavaType();
      case "BFILE":
        return BFILE.getJavaType();
      case "NUMBER":
        return NUMBER.getJavaType();
      case "BINARY_FLOAT":
        return BINARY_FLOAT.getJavaType();
      case "BINARY_DOUBLE":
        return BINARY_DOUBLE.getJavaType();
      case "DATE":
        return DATE.getJavaType();
      case "TIMESTAMP":
        return TIMESTAMP.getJavaType();
      case "RAW":
        return RAW.getJavaType();
      case "XMLType":
        return XMLType.getJavaType();
      default:
        return null;
    }
  }

  /**
   * 获取：数据库类型
   */

  public String getDbType() {
    return dbType;
  }

  /**
   * 获取：Java类型
   */

  public String getJavaType() {
    return javaType;
  }

}
